﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;

namespace Zx.List
{
    /// <summary>
    /// 分页结果集
    /// </summary>
	public interface IPageList<T>
	{
		IList<T> Items { get; set; }
		int TotalCount { get; set; }
		int PageSize { get; set; }
		int Page { get; set; }
        int PageCount { get; }
	}

    /// <summary>
    /// 分页结果集
    /// </summary>
    /// <typeparam name="T"></typeparam>
	public class PageList<T> : IPageList<T>
	{
		public IList<T> Items
		{
			get; set;
		}
		public int TotalCount
		{
			get; set;
		}
		public int PageSize
		{
			get; set;
		}
		public int Page
		{
			get; set;
		}

        public int PageCount
        {
            get
            {
                return (int)Math.Ceiling((double)TotalCount / PageSize);
            }
        }
    }
}
